import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../widget/my_image.dart';
import '../utils/dio_util.dart';
class CollectPage extends StatefulWidget {
  @override
  _CollectPageState createState() => _CollectPageState();
}

class _CollectPageState extends State<CollectPage> {

  //获取收藏列表
  Future<Map<String,dynamic>>getCollect() async{
    String api='/api/mall/user/collect.service';
    DioUtil dio=DioUtil();
    return await dio.get(api);
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('收藏商品',
          style: TextStyle(
              fontSize: 30.sp,
              fontWeight: FontWeight.bold),),
        centerTitle: true,
      ),
      body: ListView.separated(
        physics: BouncingScrollPhysics(),
        separatorBuilder: (context,index){
          return Divider();
        },
        itemBuilder: (context, int index) {
          return Container(
            decoration: BoxDecoration(color: Colors.white),
            padding: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.w),
            child: Row(
              children: [
                Container(
                  width: 200.w,
                  height: 200.w,
                  child: ClipRRect(
                    borderRadius: BorderRadius.all(Radius.circular(15.w)),
                    child: MyImage(
                      imgSrc:'http://himg2.huanqiu.com/attachment2010/2012/0607/20120607092007325.jpg',
                    ),
                  ),
                ),
                SizedBox(
                  width: 20.w,
                ),
                Expanded(
                  child: Container(
                    height: 200.w,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          "商品名称商品名称商品名称商品名称商品名称商品名商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称称商品名称商品名称",
                          overflow: TextOverflow.ellipsis,
                          maxLines: 2,
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              '￥100.00',
                              style: TextStyle(color: Colors.red),
                            ),
                            OutlineButton(
                              onPressed: () {},
                              child: Text('删除',style: TextStyle(
                                  fontSize: 25.sp
                              ),),
                            )
                          ],
                        )
                      ],
                    ),
                  ),
                )
              ],
            ),
          );
        },
        itemCount: 10,
      ),
    );
  }
}
